package io.guo;

import io.guo.aop.ISchool;
import io.guo.spring.Klass;
import io.guo.spring.School;
import io.guo.spring.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({Student.class, Klass.class})
@ConditionalOnProperty(prefix = "guo.question8", name = "enabled", havingValue = "true")
@ComponentScan("io.guo.*")
public class MyAutoConfiguration {


    @Autowired
    private Student student;


    @Autowired
    private Klass klass;

    @Bean("school")
    public ISchool school(){
        return new School(klass, student);
    }
}
